import  actionType from  "../action/index"
let initList:any = [//引用类型
    {
        key: '1',
        id: 1,
        name: '胡彦斌',
        age: 32,
        address: '西湖区湖底公园1号',
    },
    {
        key: '2',
        id: 2,
        name: '胡彦祖',
        age: 42,
        address: '西湖区湖底公园1号',
    },
    {
        key: '3',
        id: 3,
        name: 'lala',
        age: 18,
        address: '金融港',
    },
]

let  listReducer = (state={list:initList},action:any)=>{

    switch(action.type){
        case  actionType.DELELIST:
            return  {list:state.list.filter((item:any)=>item.id!=action.playload)}
    }

    return  state;

}

export  default  listReducer;